import axios from 'axios'
import { message } from 'antd'
// 创建axios实例
const service = axios.create({
    timeout: 10000
})
// request拦截器
service.interceptors.request.use(
    config => {
        const userinfo = localStorage.getItem('user');
        config.headers.Authorization = userinfo && `Bearer ${JSON.parse(userinfo).token}`;
        return config;
    }, 
    error => {
        Promise.reject(error)
    }
)

export default service;
